'use strict';

/**
 * @name AnnouncementCtrl
 * @author Yud
 */

angular.module('metalabOperationApp').controller('AnnouncementCtrl', ['$scope', 'MetaResources', 'MetaRemind', 'MetaUtils', function($scope, MetaResources, MetaRemind, MetaUtils) {
    $scope.editCtrl = {
        data: []
    };

    $scope.getEditData = function() {
        MetaResources.update.query({
                '_sort': '-created_at',
                'tag': '公告',
                '_range': '1_1'
            },
            function(data) {
                if (data) {
                    $scope.editCtrl.data = data;
                }
            },
            function(error) {
                MetaRemind.serverError(error);
            });
    };

    $scope.init = function() {
        $scope.openModel = MetaUtils.openModel;
        $scope.getEditData();
    };

    $scope.toBeContinued = MetaRemind.error;
    $scope.init();

}]);
